FROM alpine as builder
ENV base=https://archive.openwrt.org/chaos_calmer/15.05.1/x86/generic/
ENV file=openwrt-15.05.1-x86-generic-Generic-rootfs.tar.gz
RUN wget -q "${base}${file}"
RUN mkdir /rootfs && tar xf "$file" -C /rootfs

FROM scratch as base
COPY --from=builder /rootfs/ /
CMD ["/bin/sh"]

FROM base
RUN mkdir -p /home/user \
 && echo 'user:!:1000:' >> /etc/group \
 && echo 'user:x:1000:1000::/home/user:' >> /etc/passwd
ENV SH=/bin/sh
